import java.util.*;
import java.util.Map;

public class Test {
    public static void main2(String[] args) {
        int[] array = {1, 3, 4, 2, 5};
        Sort66 sort = new Sort66();
        sort.mergeSort(array);
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }

    /*public static void main3(String[] args) {
        SearchTree searchTree=new SearchTree();
        int[] array={80,30,48,60,90,56};
        for (int i = 0; i < array.length; i++) {
            System.out.println( searchTree.insert(array[i]));
        }
        System.out.println("========");
    }*/
    static class Student implements Comparable<Student> {

        @Override
        public int compareTo(Student o) {
            return 0;
        }
    }


    public static void main3(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        Map<String, Integer> map2 = new TreeMap<>();
        map2.put("aaa", 5);
        map2.put("bbb", 4);
        map2.put("ccc", 3);
        map2.put("ddd", 2);
        Set<Map.Entry<String, Integer>> set5 = map2.entrySet();
        for (Map.Entry<String, Integer> set : set5) {
            System.out.println("key:" + set.getKey() + "val:" + set.getValue());
        }
        System.out.println(set5);
        System.out.println(map2);
        System.out.println(map2.get("aaa"));
        System.out.println(map2.get("eee"));//没有返回null
        System.out.println(map2.getOrDefault("ffff", 8));//先从里面找没找到取默认值。里面没有返回你输入的默认值
        Map<Student, Integer> map1 = new TreeMap<>();
        map1.put(new Student(), 3);
        Set<String> set = new HashSet<>();
        Set<String> set1 = new TreeSet<>();
        Set<String> set2 = map2.keySet();
        System.out.println(set2);
        Collection<Integer> list = map2.values();
        System.out.println(list);
    }

    /*  public static void main(String[] args) {
          int[] array=new int[10_0000];
          Random random = new Random();
          for (int i = 0; i < array.length; i++) {
              array[i]=random.nextInt(10000 );
          }
      }*/
    public static void main5(String[] args) {
        Test test = new Test();
        int[] array = {1, 2, 2, 3};
        System.out.println(test.singleNumber2(array));
    }

    public static void func1(int[] array) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < array.length; i++) {
            set.add(array[i]);
        }
    }

    public static int func2(int[] array) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < array.length; i++) {
            if (!set.contains(array[i])) {
                set.add(array[i]);
            } else {
                return array[i];
            }
        }
        return -1;
    }

    public void func3(int[] array) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < array.length; i++) {
            int key = array[i];
            if (map.get(key) == null) {
                map.put(key, 1);
            } else {
                int val = map.get(key);
                map.put(key, val + 1);
            }
        }
        System.out.println(map);
    }

    public int singleNumber(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            int key = nums[i];
            if (map.get(key) == null) {
                map.put(key, 1);
            } else {
                int val = map.get(key);
                map.put(key, val + 1);
            }

        }

        for (int i = 0; i < nums.length; i++) {
            if (map.get(nums[i]) == 1) ;
        }
        return 3;
    }

    public int singleNumber2(int[] nums) {
        Set<Integer> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
            if (!set.contains(nums[i])) {
                set.add(nums[i]);
            } else {
                set.remove(nums[i]);
            }
        }
        for (int i = 0; i < nums.length; i++) {
            if (set.contains(nums[i])) {
                return nums[i];
            }
        }
        return -1;
    }

    public int numJewelsInStones1(String jewels, String stones) {
        Set<Character> set = new HashSet<>();
        int baoshi = 0;
        for (int i = 0; i < jewels.length(); i++) {
            set.add(jewels.charAt(i));
        }
        for (int i = 0; i < stones.length(); i++) {
            if (set.contains(stones.charAt(i))) {
                baoshi++;
            }
        }
        return baoshi;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str1 = new String();
            String str2 = new String();
            funcc(str1, str2);
        }
    }

    public static void funcc(String str1, String str2) {
        Set<Character> set = new HashSet<>();
        for (char ch : str2.toUpperCase().toCharArray()) {
            set.add(ch);
        }
        Set<Character> set2 = new HashSet<>();
        for (char ch : str1.toUpperCase().toCharArray()) {
            if (!set.contains(ch) && !set2.contains(ch)) {
                System.out.print(ch);
                set2.add(ch);
            }
        }
    }


    public int firstUniqChar(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            Character key = s.charAt(i);
            if (map.get(key)==null) {
                map.put(key, 1);
            } else {
                int val = map.get(key);
                if (map.containsKey(key)) {
                    map.put(key, val + 1);
                }
            }
        }
        for (int i = 0; i < s.length(); i++) {
            if (map.get(s.charAt(i)) == 1) {
                return s.charAt(i);
            }
        }
        return -1;
    }
}
